function [] = makeSpatialMatrix_sameGeoAggEntity(inputFolder, outputFolder)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% This function creates matrices of type sameDEP, sameRegionId, etc..
%% To do this, it reads the files that match each (small) entity to bigger entities.
%% These files are created earlier in the data_cleaning process, and are stored in
%% folder ../data/${PROCESSING_DATE}/timeLocationAggregations/location
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

aggEntities   = {'DEP'};

for s2 = 1:length(aggEntities)
	aggEntity   = aggEntities{s2};
	disp(sprintf('%s...', aggEntity))
	
	Wname = sprintf('same%s', aggEntity);
	inputFile  = sprintf('%s/%s.mat', inputFolder, aggEntity);
	outputFile = sprintf('%s/%s.mat', outputFolder, Wname);
	
	% Load input file
	load(inputFile, 'FEs', 'ids');
	geoLabels = ids;
	
	% Make W --> equal to one if small entities k and k' belong to same big entity
	W = sparse(double(FEs == FEs'));
	
	% Save to output file
	save(outputFile, 'W', 'Wname', 'geoLabels');
	
	clear FEs ids geoLabels;
end

end